<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML>
<html>
  <head>
    <title>My JSP 'post.jsp' starting page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <%@include file="/WEB-INF/jsp/public/commons.jspf"%>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/base.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/tiezi.css" />
 	<script src="${pageContext.request.contextPath }/ckeditor/ckeditor.js"></script>
<%--  	<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath }/script/base.js"></script> --%>
  </head>
  
  <body>
<!--发表新帖-->
<div class="frame11">
    <a href="javascript:history.go(-1)"><div class="back ico"></div></a>
    <div class="ntoTitle">
    	<strong>发表新帖</strong><span>
    	<i class="ico"></i>
    	<a href="${pageContext.request.contextPath }/personal_center.action?id=${user.id}">我的帖子</a></span>
    </div>
    <div class="ntoTab">
    	<h4>所属模块：<a href="${pageContext.request.contextPath }/topic_list.action?id=${forum.id}"><strong>${forum.name }</strong></a></h4>
    </div>
    <div class="tabCon-A">
    	<form id="myform" class="form-horizontal" action="${pageContext.request.contextPath }/topic_post.action" method="post" onsubmit="return check(this)">
    		<input type="hidden" name="forumid" value="${forum.id }"/>
	    	<div class="form-group filTitle"> 
	    		<label for="firstname" class="col-sm-1 control-label"><h4>标题</h4></label>
	    		<div class="col-sm-6">
				   <input type="text" class="form-control" name="title" placeholder="请填写标题" autocomplete="off" required data-bv-notempty-message="标题不能为空"/>
	    		</div>          
				<!-- <div class="col-sm-4" id="subject_num">0/50</div> -->
	        </div>
	        <div class="form-group">
	        	<label for="firstname" class="col-sm-1 control-label"><h4>内容</h4></label>
	        	<div class="col-sm-6 lnbrd">
		            <textarea class="form-control" id="content" name="content" rows="10" cols="150">
		                
		            </textarea>
		        </div> 
	        </div>
	         
	        <div class="subfx form-group">
	        	<div class="col-sm-6"></div>
	        	<div class="col-sm-6">
	            	<input type="submit" value=""  class="fbbtn ico" />
	            </div>
	            <!-- <input type="button" value="" id="saveThread" class="bcbtn ico" /> -->
	        </div>
        </form>
    </div>
</div>



 <!--论坛 右侧漂浮-->
<!--<ul class="R-fixed" id="cnmoBbsRightFloater" style="display:none">
	<li><a href="http://bbs.cnmo.com/" class="fix rt-a"></a></li>		
	<li><a href="index.php?c=Thread&m=Post&fid=2058" class="fix rt-b"></a></li>
	<li><a class="fix rt-c" onclick="signIn()"></a></li>
	<li><a href="http://www.cnmo.com/webcenter/debug.html" class="fix rt-d"></a></li>
	<li><a href="javascript:void(CommonFuns.goTop());" class="fix rt-e"></a></li>
</ul> -->

<script type="text/javascript">
    var editor=CKEDITOR.replace( 'content',{
		customConfig: '${pageContext.request.contextPath }/script/topicConfig.js'//自定义配置文件
	});
	
    
	
	function check(form){
		var content=CKEDITOR.instances.content.getData();
		if(content==""){
			$.bootstrapGrowl("您的内容为空！无法提交.",{
					type:'warning',
					//offset:{from: 'top', amount: 100},
					align:'center',
					width:250,
					delay:4000,
					allow_dismiss:true
				
			});
			$("#myform").data("bootstrapValidator").validate('content');
			return false;
		}
		return true;
	}
	$(function(){
		//CKEDITOR.instances.content.updateElement();
		
		
		$("#myform").bootstrapValidator({
			message: 'This value is not valid',
			feedbackIcons: {
				valid: 'glyphicon glyphicon-ok',
				invalid: 'glyphicon glyphicon-remove',
				validating: 'glyphicon glyphicon-refresh'
				},
	        fields: {
	        	name: {
	                message: '用户名验证失败',
	                validators: {
	                    notEmpty: {
	                        message: '题目不能为空'
	                    }
	                }
	            },
	            content: {
	            	group: '.lnbrd',
	                validators: {
	                    notEmpty: {
	                        message: '内容不能为空'
	                    }
	                }
	            }
	        }
	    });
		$("#myform").find('[name="content"]')
	    .ckeditor()
	    .editor
	    .on('change', function() {
	      $('#myform').bootstrapValidator('revalidateField', 'content');
	    });
	});
	/* editor.on('change', function(ev){
		$("#myform").bootstrapValidator('revalidateField', 'content');
	}); */
</script>
  </body>
</html>
